package com.yuyou.fn.common.util;

/**
 * Created by wens on 2017/7/19.
 */
public class Principals {

    private static final Principal DEFAULT = new Principal(null , "系统") ;

    private static final ThreadLocal<Principal> threadLocal = new ThreadLocal<>();

    public static void set(Principal principal){
        threadLocal.set(principal);
    }

    public static Principal get(){
        return threadLocal.get();
    }

    public static Principal getDefaultPrincipal() {
        return DEFAULT ;
    }

    public static class Principal{

        public Long id ;
        public String name ;

        public Principal(Long id, String name) {
            this.id = id;
            this.name = name;
        }

        public Principal(){

        }
    }

}
